package c.c.b.b.f;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/* compiled from: ByteArrayPool */
public class e {
    public static final Comparator<byte[]> e = new a();
    public final List<byte[]> a = new ArrayList();
    public final List<byte[]> b = new ArrayList(64);
    public int c = 0;
    public final int d;

    /* compiled from: ByteArrayPool */
    public static class a implements Comparator<byte[]> {
        public int compare(Object obj, Object obj2) {
            return ((byte[]) obj).length - ((byte[]) obj2).length;
        }
    }

    public e(int i) {
        this.d = i;
    }

    /* JADX WARNING: Missing block: B:28:0x004c, code skipped:
            return;
     */
    public synchronized void a(byte[] r3) {
        /*
        r2 = this;
        monitor-enter(r2);
        if (r3 == 0) goto L_0x004b;
    L_0x0003:
        r0 = r3.length;	 Catch:{ all -> 0x0048 }
        r1 = r2.d;	 Catch:{ all -> 0x0048 }
        if (r0 <= r1) goto L_0x0009;
    L_0x0008:
        goto L_0x004b;
    L_0x0009:
        r0 = r2.a;	 Catch:{ all -> 0x0048 }
        r0.add(r3);	 Catch:{ all -> 0x0048 }
        r0 = r2.b;	 Catch:{ all -> 0x0048 }
        r1 = e;	 Catch:{ all -> 0x0048 }
        r0 = java.util.Collections.binarySearch(r0, r3, r1);	 Catch:{ all -> 0x0048 }
        if (r0 >= 0) goto L_0x001b;
    L_0x0018:
        r0 = -r0;
        r0 = r0 + -1;
    L_0x001b:
        r1 = r2.b;	 Catch:{ all -> 0x0048 }
        r1.add(r0, r3);	 Catch:{ all -> 0x0048 }
        r0 = r2.c;	 Catch:{ all -> 0x0048 }
        r3 = r3.length;	 Catch:{ all -> 0x0048 }
        r0 = r0 + r3;
        r2.c = r0;	 Catch:{ all -> 0x0048 }
        monitor-enter(r2);	 Catch:{ all -> 0x0048 }
    L_0x0027:
        r3 = r2.c;	 Catch:{ all -> 0x0045 }
        r0 = r2.d;	 Catch:{ all -> 0x0045 }
        if (r3 <= r0) goto L_0x0042;
    L_0x002d:
        r3 = r2.a;	 Catch:{ all -> 0x0045 }
        r0 = 0;
        r3 = r3.remove(r0);	 Catch:{ all -> 0x0045 }
        r3 = (byte[]) r3;	 Catch:{ all -> 0x0045 }
        r0 = r2.b;	 Catch:{ all -> 0x0045 }
        r0.remove(r3);	 Catch:{ all -> 0x0045 }
        r0 = r2.c;	 Catch:{ all -> 0x0045 }
        r3 = r3.length;	 Catch:{ all -> 0x0045 }
        r0 = r0 - r3;
        r2.c = r0;	 Catch:{ all -> 0x0045 }
        goto L_0x0027;
    L_0x0042:
        monitor-exit(r2);	 Catch:{ all -> 0x0048 }
        monitor-exit(r2);
        return;
    L_0x0045:
        r3 = move-exception;
        monitor-exit(r2);	 Catch:{ all -> 0x0048 }
        throw r3;	 Catch:{ all -> 0x0048 }
    L_0x0048:
        r3 = move-exception;
        monitor-exit(r2);
        throw r3;
    L_0x004b:
        monitor-exit(r2);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.b.b.f.e.a(byte[]):void");
    }

    public synchronized byte[] b(int i) {
        for (int i2 = 0; i2 < this.b.size(); i2++) {
            byte[] bArr = (byte[]) this.b.get(i2);
            if (bArr.length >= i) {
                this.c -= bArr.length;
                this.b.remove(i2);
                this.a.remove(bArr);
                return bArr;
            }
        }
        return new byte[i];
    }
}
